#include <gtk/gtk.h>   //导入gtk
  
//
static void app_activate (GApplication *app, gpointer *user_data) {
  GtkWidget *win;
  //标签
  GtkWidget *lab;
  win = gtk_application_window_new (GTK_APPLICATION (app));
  //设置标题
  gtk_window_set_title (GTK_WINDOW (win), "我的第一个c语言窗口");
  //设置默认大小
  gtk_window_set_default_size (GTK_WINDOW (win), 400, 300);
  //设置一个标签
  lab = gtk_label_new("hello, gtk4!");
  //把标签作为窗体的子元素进行添加
  gtk_window_set_child(GTK_WINDOW(win),lab);
  //显示窗体
  gtk_widget_show (win);
}
  
  //程序入口
int main (int argc, char **argv) {
  GtkApplication *app;
  int stat;

  app = gtk_application_new ("com.github.ToshioCP.pr2", G_APPLICATION_FLAGS_NONE);
  g_signal_connect (app, "activate", G_CALLBACK (app_activate), NULL);
  stat =g_application_run (G_APPLICATION (app), argc, argv);
  g_object_unref (app);
  return stat;
}
